﻿#region

using System;
using System.Security.Principal;
using HouseHoldBudget.Core.Entities.User;

#endregion

namespace HouseHoldBudget.Core.Authentication
{
    public class BudgetIdentity : IIdentity
    {
        #region Constructors

        public BudgetIdentity()
        {
            CurrentUser = new BudgetUser();
        }

        public BudgetIdentity(BudgetUser user)
        {
            CurrentUser = user;
        }

        #endregion

        #region Instance Properties

        public BudgetUser CurrentUser { get; private set; }

        #endregion

        #region IIdentity Members

        public string Name
        {
            get
            {
                return CurrentUser.UserFirstName;
            }
        }


        public string AuthenticationType { get; private set; }

        public bool IsAuthenticated
        {
            get
            {
                return !String.IsNullOrEmpty(Name);
            }
        }

        #endregion

        #region Class Methods

        /// <summary>
        ///   Gets an anonymous user.
        /// </summary>
        /// <returns> </returns>
        public static BudgetIdentity GetAnonymous()
        {
            return new BudgetIdentity();
        }

        #endregion
    }
}